home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr01 / halcn305.zip / GSDMO_22.PAS < prev    next >
Pascal/Delphi Source File  |  1993-05-02  |  2KB  |  73 lines

  1. program GSDMO_22;
  2. {------------------------------------------------------------------------------
  3.                                Getting More Files Open
  4.  
  5.        Copyright (c)  Richard F. Griffin
  6.  
  7.        06 February 1993
  8.  
  9.        102 Molded Stone Pl
  10.        Warner Robins, GA  31088
  11.  
  12.        -------------------------------------------------------------
  13.        This unit demonstrates how to increase the number of files that can
  14.        be opened in a program.
  15.  
  16.        The program will open all the *.PAS files in the current directory.
  17.        The procedure SetFileHandles() will allow the program to open as
  18.        many files as needed at the same time, up to the number passed as
  19.        the argument (not to exceed 255).  This number cannot exceed the
  20.        value given in the FILES= command in the AUTOEXEC.BAT file.
  21.  
  22.        New procedures/functions introduced are:
  23.  
  24.                  SetFileHandles
  25.  
  26. -------------------------------------------------------------------------------}
  27.  
  28. uses
  29.    GSOB_Var,
  30.    GSOBShel,
  31.    {$IFDEF WINDOWS}
  32.       WinDos,
  33.       WinCRT;
  34.    {$ELSE}
  35.       Dos,
  36.       CRT;
  37.    {$ENDIF}
  38.  
  39.         {The following types map DOS and WINDOWS TP names to be the same}
  40.  
  41. {$IFNDEF WINDOWS}
  42. const
  43.    faArchive = Archive;
  44. type
  45.    TSearchRec = SearchRec;
  46. {$ENDIF}
  47.  
  48. var
  49.   DirInfo: TSearchRec;
  50.   filary : array[0..99] of text;
  51.   i      : integer;
  52.  
  53. begin
  54.    ClrScr;
  55.  
  56.    SetFileHandles(99);            {Comment out to confirm default limit}
  57.  
  58.    FindFirst('*.PAS', faArchive, DirInfo);
  59.    i := 0;
  60.    while DosError = 0 do
  61.    begin
  62.       WriteLn(i:3,'  ',DirInfo.Name);
  63.       Assign(filary[i],DirInfo.Name);
  64.       Reset(filary[i]);
  65.       inc(i);
  66.       FindNext(DirInfo);
  67.    end;
  68. end.
  69.  
  70.  
  71.  
  72.  
  73.